import os
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import Node


def generate_launch_description():

    sim_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            [
                os.path.join(get_package_share_directory("robot_sim_mi9"), "launch"),
                "/sim_mi9_launch.py",
            ]
        )
    )

    robot_ctrl = Node(
        package="chassis_control_mi9",
        executable="CascadePIDCtrl",
        name="robot_control_cascadePID_mi9",
        parameters=[{"AngleP": 100.0, "AngleI": 0.0, "AngleD": 0.0}],
    )

    return LaunchDescription([sim_launch, robot_ctrl])
